import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('data/pima_train_processed.csv')
data = df.drop('ID',axis=1)

correlation_with_target = data.corr()['Outcome'].sort_values(ascending=False)

print("相关性排序：")
print(correlation_with_target)

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.figure(figsize=(10, 6))
correlation_with_target.drop('Outcome').plot(kind='barh', color='skyblue')
plt.title('不同特征与糖尿病相关性')
plt.xlabel('相关性')
plt.ylabel('特征')
plt.tight_layout()
plt.show()